package com.example.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultBody<T> {
    private Integer code;
    private Boolean result;
    private T data;
    private String msg;


public ResultBody(Boolean result, T data, String msg) {
    this.result = result;
    if(result){
        this.code =20000;
    }else {
        this.code=50000;
    }
        this.data = data;
        this.msg = msg;
    }

//    失败返回
    public ResultBody(String msg) {
        this.code = 50000;
        this.data=null;
        this.result = false;
        this.msg = msg;
    }
}
